import os


def get_root():
    """最简单的项目根目录查找"""
    current = os.getcwd()

    while current != os.path.dirname(current):
        # 检查关键文件
        if (os.path.exists(os.path.join(current, '../../../../AegisSentinel.py')) or
                os.path.exists(os.path.join(current, 'requirements.txt'))):
            return current
        current = os.path.dirname(current)

    return os.getcwd()

# 使用
root = get_root()
print(root)